import { createApp } from 'vue'
import App from './App.vue'

import router from './router'
import store from './store.js'
import Vant from 'vant';
import './main.css'
import 'vant/lib/index.css';

import { get,post } from "./api/api.js"; 
import { encrypt,decrypt } from "./lib/jsencrypt";
import { Toast } from 'vant';
const app = createApp(App);

app.config.globalProperties.get = get 
app.config.globalProperties.post = post
app.config.globalProperties.encrypt = encrypt 
app.config.globalProperties.decrypt = decrypt
app.config.globalProperties.Toast = Toast

app.config.globalProperties.changeUrl = function(url){ // changeUrl("/") 
	window.location.href  =  window.host + "#" + url
} 
app.config.globalProperties.isEmpty = function(s){  
	return !s || /^\s*$/g.test(s)
} 
app.config.globalProperties.regPhone = function(str){  
	if(!(/^1[34578]\d{9}$/.test(str))){
	   Toast('请输入正确的手机号')
	   return true;
	} 
}
app.config.globalProperties.regEmail = function(str){  
	if(!(/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(str))){
		Toast('请输入正确的邮箱') 
		return true;
	} 
}
app.config.globalProperties.regPassword = function(str){  
	if (!(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test( str ))) {
		 Toast( '密码需要，8—16位数字加字母'); 
		return true;
	}
}
 

//  window.location.origin +"/#/?address=" + this.address,  

app.use(Vant);
app.use(router)
app.use(store)  
app.mount('#app')
/*


*/
